package com.nan.buy.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nan.buy.model.Idea;
import com.nan.buy.service.IdeaService;

/**
 * 查看回复客户信息
 * @author 孙楠楠
 *
 */
@Controller
@RequestMapping("idea")
public class IdeaController {

	@Resource
	private IdeaService ideaService;
	
	/*
	 * 查询所有客户得留言
	 */
	@RequestMapping("search")
	@ResponseBody
	public List<Idea> searchIdea(){
		return ideaService.searchIdea();
	}
	
	/*
	 * 回复客户得留言
	 */
	@RequestMapping("update")
	@ResponseBody
	public Object updateIdea(Idea idea){
		int msg=ideaService.updateIdea(idea);
		return (msg != 0) ? true : false;
	}
	
	/*
	 * 删除回复信息
	 */
	@RequestMapping("del")
	@ResponseBody
	public Object updateIdeaReMsg(Idea idea){
		int msg=ideaService.updateIdeaReMsg(idea);
		return (msg != 0) ? true : false;
	}
	
	/*
	 * 添加反馈信息
	 */
	@RequestMapping("add")
	@ResponseBody
	public Object add(Idea idea) {
		int msg = ideaService.insertSelective(idea);
		return (msg != 0) ? true : false;
	}
}
